package Day_05;
import java.util.Scanner;
public class ExtendFourDemo {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        System.out.println("Please Enter the Number(10) and the Scale(100):");
        int num = scan.nextInt() , scale = scan.nextInt();
        // generate array
        int[] a = new int[num];
        for (int i = 0; i < a.length; i++) {
            a[i] = (int)(Math.random()*scale);
            System.out.print(a[i]+" ");
        }System.out.println();

        // find max & min
        int max = a[0], min = a[0];
        for (int i = 1; i < a.length; i++) {
            if(max<a[i]){
                max = a[i];
            }
        }
        for (int i = 1; i < a.length; i++) {
            if(min>a[i]){
                min = a[i];
            }
        }

        // print max & min
        System.out.println("max:"+max+",min:"+min);


    }
}
